package kr.pe.johnkim.checkmileage.mobile.rest.dao;

import kr.pe.johnkim.checkmileage.mobile.domain.CheckMileageCertification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * Check Mileage 인증 번호 관련 DAO 메소드들을 구현하는 클래스 이다.
 *
 * @author : johnkim <cale9797@gmail.com / Bettersoft, Inc.>
 * @Date : 12. 8. 3
 */
public class CheckMileageCertificationDaoImpl extends SqlMapClientDaoSupport implements CheckMileageCertificationDao {

    // SLF4J Logging
	private Logger logger = LoggerFactory.getLogger(CheckMileageCertificationDaoImpl.class);

    /**
     * 인증번호를 등록 한다.
     *
     * @param checkMileageCertification
     */
    @Override
    public void registerCertification(CheckMileageCertification checkMileageCertification) {
        logger.info("registerCertification");
        getSqlMapClientTemplate().insert("CHECKMILEAGE_CERTIFICATIONS.registerCertification", checkMileageCertification);
    }

    /**
     * 해당 사용자의 인증 정보가 있는지 확인 한다.
     *
     * @param checkMileageCertification
     * @return
     */
    @Override
    public CheckMileageCertification selectExistCertificationInformation(CheckMileageCertification checkMileageCertification) {
        logger.info("selectExistCertificationInformation");
        return (CheckMileageCertification)getSqlMapClientTemplate().queryForObject("CHECKMILEAGE_CERTIFICATIONS.selectExistCertificationInformation", checkMileageCertification);
    }

    /**
     * 해당 사용자의 인증 정보를 가져 온다.
     *
     * @param checkMileageCertification
     * @return
     */
    @Override
    public CheckMileageCertification selectCertificationInformation(CheckMileageCertification checkMileageCertification) {
        logger.info("geCertification selectCertificationInformation");
        return (CheckMileageCertification)getSqlMapClientTemplate().queryForObject("CHECKMILEAGE_CERTIFICATIONS.selectCertificationInformation", checkMileageCertification);
    }

    /**
     * 해당 인증 정보를 비활성화 한다.
     *
     * @param checkMileageCertification
     */
    @Override
    public void updateDeactivateCertification(CheckMileageCertification checkMileageCertification) {
        logger.info("updateDeactivateCertification");
        getSqlMapClientTemplate().update("CHECKMILEAGE_CERTIFICATIONS.updateDeactivateCertification", checkMileageCertification);
    }
}
